package com.xmx.usercenter.controller;

import java.util.Arrays;
import java.util.Map;

//import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import io.swagger.annotations.ApiOperation;
import com.xmx.usercenter.entity.IntegrationConsumeSettingEntity;
import com.xmx.usercenter.service.IntegrationConsumeSettingService;
import com.xmx.common.utils.PageUtils;
import com.xmx.common.utils.R;
import io.swagger.annotations.Api;


/**
 * 积分消费设置
 *
 * @author fbb
 * @email boyinbing@126.com
 * @date 2021-08-11 01:37:13
 */
@Api(tags = "IntegrationConsumeSettingController", description = "积分消费设置服务")
@RestController
@RequestMapping("usercenter/integrationconsumesetting")
public class IntegrationConsumeSettingController {
    @Autowired
    private IntegrationConsumeSettingService integrationConsumeSettingService;

    /**
     * 列表
     */
    @GetMapping("/list")
    //@RequiresPermissions("usercenter:integrationconsumesetting:list")
    @ApiOperation("获取所有积分消费设置信息")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = integrationConsumeSettingService.queryPage(params);

        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @GetMapping("/info/{id}")
    //@RequiresPermissions("usercenter:integrationconsumesetting:info")
    @ApiOperation("获取指定id的积分消费设置详情")
    public R info(@PathVariable("id") Long id){
		IntegrationConsumeSettingEntity integrationConsumeSetting = integrationConsumeSettingService.getById(id);

        return R.ok().put("integrationConsumeSetting", integrationConsumeSetting);
    }

    /**
     * 保存
     */
    @PostMapping("/save")
    @ApiOperation("添加积分消费设置信息")
    //@RequiresPermissions("usercenter:integrationconsumesetting:save")
    public R save(@RequestBody IntegrationConsumeSettingEntity integrationConsumeSetting){
		integrationConsumeSettingService.save(integrationConsumeSetting);

        return R.ok();
    }

    /**
     * 修改
     */
    @PutMapping("/update")
    @ApiOperation("更新指定id积分消费设置信息")
    //@RequiresPermissions("usercenter:integrationconsumesetting:update")
    public R update(@RequestBody IntegrationConsumeSettingEntity integrationConsumeSetting){
		integrationConsumeSettingService.updateById(integrationConsumeSetting);

        return R.ok();
    }

    /**
     * 删除
     */
    @DeleteMapping("/delete")
    @ApiOperation("删除指定id积分消费设置信息")
    //@RequiresPermissions("usercenter:integrationconsumesetting:delete")
    public R delete(@RequestBody Long[] ids){
		integrationConsumeSettingService.removeByIds(Arrays.asList(ids));

        return R.ok();
    }

}
